/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: max.jianhua
 * @Last Modified time: 2020-11-20 15:21:28
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';


// 风险经销商清单维护（OEM）	模版导入
export const importExcel = (params) => axios.post(`${SERVER.WHOLESALES}/tmFiRiskDealer/upload`, params, {
  responseType: 'arraybuffer'
});

// 风险经销商清单维护（ OEM） excel导出 /tmFiRiskDealer/excel
export const exportExcel = (params) => axios.post(`${SERVER.WHOLESALES}/tmFiRiskDealer/excel`, params, {
  responseType: 'blob'
})


// 风险经销商清单维护（ OEM） 分页查询 /tmFiRiskDealer/page
export const queryList = (params) => axios.post(`${SERVER.WHOLESALES}/tmFiRiskDealer/page`, params)

// 风险经销商清单维护（ OEM） 根据主键新增或修改单条数据 /tmFiRiskDealer/saveOne
export const saveOne = (params) => axios.post(`${SERVER.WHOLESALES}/tmFiRiskDealer/saveOne`, params)

// 风险经销商清单维护（ OEM） 查询单条 /tmFiRiskDealer/selectOne?id=主键dealerId
export const selectOne = (id) => axios.get(`${SERVER.WHOLESALES}/tmFiRiskDealer/selectOne?id=${id}`)


// 事业部列表 /api/sysManage/org/getOrgByOrgType4cms?orgType=15061005

export const getOrigions = () => axios.get(`${SERVER.SYSMANAGE}/org/getOrgByOrgType4cms?orgType=15061005`)

// 根据事业部id查询办事处列表,parentOrgId为事业部id /api/sysManage/org/getOrgByOrgType4cms?orgType=15061007&parentOrgId=8
export const getOffices = (orgType) => axios.get(`${SERVER.SYSMANAGE}/org/getOrgByOrgType4cms?orgType=${orgType}`)

//  根据经销商编号查询库存系数 /ttDealerMonthData/getStockFactorByDealerCode?dealerCode=经销商编码
export const getStockFactor = (dealerCode) => axios.get(`${SERVER.WHOLESALES}/ttDealerMonthData/getStockFactorByDealerCode?dealerCode=${dealerCode}`)


// 操作记录
export const queryLog = (Id) => axios.get(`${SERVER.WHOLESALES}/tmFiRiskDealer/selectLog?id=${Id}`)

// / 导出
export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);
